import moment from 'moment/moment'
const DATE_TIME_FORMATTER = 'YYYY/MM/DD HH:mm:ss'

export const timeFormatter = (time, type = DATE_TIME_FORMATTER) => {
  if (!time) return ''
  const m = moment(time)
  if (m.isValid()) {
    return m.format(type)
  }
  return '时间有误'
}
export function toISOString(time) {
  return moment(time).toISOString()
}
